﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Think.Lenovo.Com.Models;
using Think.Lenovo.Com.Models.Users;
using Think.Lenovo.Com.DataAccess;
using System.Configuration;
using Think.Lenovo.Com.Common;
namespace Think.Lenovo.Com.qiantai
{
    public partial class feedbackhistory : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ViewUserModel model = null;
            #region//判断登录
            try
            {
                model = (ViewUserModel)Session["User"];
            }
            catch (Exception ex)
            {
                String logFolder = ConfigurationManager.AppSettings["LogRoot"];
                Log.RecordLog(logFolder, ex);
                Response.Redirect("/home/login.aspx");
            }
            if (model != null)
            {
                if (model.Id < 1)
                {
                    Response.Redirect("Login.aspx");
                    return;
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
                return;
            }

            #endregion

            int pageIndex = 0;
            int pageSize = 5;
            if (!Int32.TryParse(Request["pageIndex"], out pageIndex))
            {
                pageIndex = 1;
            }
            #region//得到当前用户的留言
            MessageBoard mb = new MessageBoard();
            List<MessageBoardModel> list = mb.GetMessages(pageIndex, pageSize, "AddUserId=" + model.Id, "AddDate desc");
            this.List.DataSource = list;
            this.List.DataBind();
            #endregion
        }
    }
}